/*
 * @Author: Simon 1958058172@qq.com
 * @Date: 2025-08-18 11:17:02
 * @LastEditors: Simon 1958058172@qq.com
 * @LastEditTime: 2025-08-18 20:02:31
 * @FilePath: \java.1212\csdn\yichang\li01\Test.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package csdn.yichang.li01;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        String username;
        String password;
        //录入用户名和密码
        Scanner scanner=new Scanner(System.in);
        username=scanner.nextLine();
        password=scanner.nextLine();
        login(username, password);
    }
    //判断登录方法
    private static void login(String username, String password) {
        if("lix".equals(username)&&"123456".equals(password)){
            System.out.println("登录成功");
        }else {System.out.println("登录错误");
        //注意只能抛出运行时异常
        throw new RuntimeException("编译异常:登录失败异常");}
    }
}
